fix: dev_mode SimpleGuard skips agent-card.json, add client.guard property#72
Conversation
…perty - Reorder _resolve_identity() so dev_mode (Case 3) takes priority over legacy agent-card.json loading (now Case 4). An A2A agent-card.json without public_keys no longer crashes SimpleGuard in dev_mode. - Skip directory walking in _resolve_project_root() when dev_mode=True - Add guard @Property on AgentIdentity for CapiscIO.connect() result
|
✅ Documentation validation passed!
|
|
✅ All checks passed! Ready for review. |
|
✅ Documentation validation passed!
|
|
✅ SDK server contract tests passed (test_server_integration.py). Cross-product scenarios are validated in capiscio-e2e-tests. |
|
✅ All checks passed! Ready for review. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
✅ SDK server contract tests passed (test_server_integration.py). Cross-product scenarios are validated in capiscio-e2e-tests. |
There was a problem hiding this comment.
Pull request overview
This PR addresses developer-experience issues in the SDK by ensuring SimpleGuard(dev_mode=True) is not disrupted by unrelated agent-card.json files, and by exposing a public guard accessor on AgentIdentity returned from CapiscIO.connect().
Changes:
- Update
SimpleGuardidentity resolution sodev_mode=Truetakes priority over legacyagent-card.jsonloading, and avoid project-root directory walking in dev mode. - Add an
AgentIdentity.guardproperty intended to provide access to aSimpleGuardinstance for signing/verifying.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
capiscio_sdk/simple_guard.py |
Reorders identity resolution to prefer dev mode over legacy agent-card.json, and skips upward directory walking when dev_mode=True. |
capiscio_sdk/connect.py |
Adds a guard property to AgentIdentity to lazily create/access a SimpleGuard instance. |
DX Audit Fixes
Found during a hands-on DX walkthrough of the getting-started docs with real API calls.
Changes
1. dev_mode now takes priority over legacy agent-card.json (Bug #1 — Critical)
SimpleGuard(dev_mode=True)crashed withConfigurationError: agent-card.json missing 'public_keys'when an A2Aagent-card.json(fromvalidate-a2a) existed in the working directory. The A2A agent card format doesn't havepublic_keys— that's a CapiscIO-specific field.Fix: Reorder
_resolve_identity()so dev_mode (Case 3) is checked before legacy agent-card.json loading (now Case 4). Also skip directory walking in_resolve_project_root()whendev_mode=True.2. Add
client.guardproperty on AgentIdentity (Bug #6)CapiscIO.connect()returns anAgentIdentitywith_guardas a private field. Users following docs had no public way to access the guard for signing. Added a@property guardthat lazily creates aSimpleGuardif needed.Breaking Changes
None. Both changes are additive or fix broken paths.
Testing
SimpleGuard(dev_mode=True)works with agent-card.json present (was crashing)client.guardreturnsSimpleGuardwith correctagent_id